#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
    int a = 0;
    for (a = 1; a < 100000; a++)
    {
        int c = a;
        long long sum = 0;
        for (c=a; (c / 10)> 0; c /= 10)
        {
            sum += (c%10)*(c%10)*(c%10);
        }
        sum += c * c * c;
        if (sum == a)
            printf("%d ", a);
    }
    return 0;
}